﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using MI.Entity;

namespace MI.ORM.Mapping
{
    public class PostMap : ClassMap<Post>
    {
        public PostMap()
        {
            Table("Posts");
            LazyLoad();
            Id(x => x.ID).GeneratedBy.Identity().Column("ID");
            References(x => x.Category).Not.LazyLoad().Column("CategoryID");
            Map(x => x.Title).Column("Title").Not.Nullable().Length(50);
            Map(x => x.Body).Column("Body").Length(250);
            Map(x => x.CreationDate).Column("CreationDate");
            Map(x => x.IsPublic).Column("IsPublic");
        }
    }
}
